<!DOCTYPE html>
<html lang="en">
<head>
    <title>{dede:global.cfg_webname/}</title>
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    {dede:include filename="common_head.htm"/}
    <link rel="stylesheet" href="{dede:global.cfg_templets_skin/}/css/seo.min.css?v=1.0.1" />
</head>
<body>
    <div class="main-wrap seo-wrap">
        <div class="content">
            <div class="context-detail" onclick="openPopup();">{dede:field.content/}</div>
            <div id="reservation-bar" class="huanglei-bar flex rcc">
                <div class="bar-box flex rcb">
                    <img class="huanglei-img" src="{dede:global.cfg_templets_skin/}/img/img_footer_bar_system.png" />

                    <div class="get-course">
                        <div>
                            <span class="info-text">免费领取价值</span>
                        </div>
                        <div>
                            <span class="red">1399元</span>
                            <span class="info-text">共享模式课程</span>
                        </div>
                    </div>

                    <form class="input-wrap footer-form" name="form">
                        <div class="ui-form-item">
                            <input type="text" placeholder="您的店铺名称" name="shop_name" id="seo-shop_name" >
                            <input type="text" placeholder="您的姓名" name="username" id="seo-username" >
                            <input type="text" placeholder="您的手机号" name="mobile" id="seo-mobile" >
                            <div class="ui-form-explain"></div>
                        </div>
                        <div class="ui-form-item">

                            <div class="ui-button flex ccc cur-p" onclick="submitSeoInfo();">立即领取</div>

                        </div>
                    </form>
                </div>
                <img class="close none" src="{dede:global.cfg_templets_skin/}/icon/icon_close.png" />
            </div>
        </div>
        {dede:include filename="common_fixed_btn.htm"/}
        {dede:include filename="footer.htm"/}
        {dede:include filename="common_script.htm"/}
    </div>
</body>
</html>
<script>
    var timer1 = null;
    var timer2 = null;
    var DURATION = 20;

    $(function() {
        timer1 = setTimeout(function() {
            openPopup();
        }, 1000 * DURATION);
    })


    function intervalPopup() {
        timer2 && clearInterval(timer2);
        timer2 = setInterval(function() {
            openPopup();
        }, 1000 * DURATION);

    }

    function openPopup() {
        timer1 && clearInterval(timer1);
        timer2 && clearInterval(timer2);

        _windowWidth = $(window).width();

        var _areaSize = _windowWidth > 900 ? ['60rem', '35rem'] : ['90vw', '35rem'];

        layer.open({
            type: 1,
            title: '',
            content: '<div class="popup-wrap flex rcb"><div class="btn-item close-btn-item none"><img src="{dede:global.cfg_templets_skin/}/icon/icon_close.png" alt="" class="btn-icon" /></div><div class="left-wrap pic-wrap popup-img-wrap"><img src="{dede:global.cfg_templets_skin/}/img/img_bg_left_system_01.png" alt="" class="pic-img popup-img" /></div><div class="flex ccc right-wrap popup-form-wrap"><div class="title-wrap"><span>价值</span><span class="red">1399元</span><span>的共享模式课程</span></div><form class="input-wrap popup-form" name="form"><div class="form-item"><input type="text" placeholder="您的店铺名称" name="shop_name" id="popup-shop_name" /></div><div class="form-item"><input type="text" placeholder="您的姓名" name="username" id="popup-username" /></div><div class="form-item"><input type="text" placeholder="您的手机号" name="mobile" id="popup-mobile" /></div><div class="flex ccc cur-p form-btn-item" onclick="submitPopupInfo();">免费领取</div></form></div></div>',            
            area: _areaSize,
            cancel: function() {
                intervalPopup();
            }
        });
    }

    // 提交申请
    function submitSeoInfo() {
        var formWrap = $('.footer-form');

        var _shop_name = $('#seo-shop_name'),
            _shop_nameVal = _shop_name.val();

        var _username = $('#seo-username'),
            _usernameVal = _username.val();

        var _mobile = $('#seo-mobile'),
            _mobileVal = _mobile.val();

        var _dateStr = new Date(),
            _currentDate = _dateStr.Format("yyyy-MM-dd hh:mm:ss");


        if (_usernameVal == '') {
            layer.msg('请输入您的姓名');
            _username.focus();
            return false;
        }

        if (_mobileVal == '') {
            layer.msg('请输入您的手机号');
            _mobile.focus();
            return false;
        } else if (!/^1[0-9]{10}/.test(_mobileVal)) {
            layer.msg('手机号格式不正确');
            _mobile.focus();
            return false;
        }


        var dataString =
            '&shop_name=' + _shop_nameVal + '（共享系统）' +
            '&username=' + _usernameVal +
            '&mobile=' + _mobileVal +
            '&create_time=' + _currentDate +
            '&ip=' + returnCitySN["cip"] +
            '&seo_engine=' + _seo_engine +
            '&action=post' +
            '&diyid=1&do=2' +
            '&dede_fields=shop_name,text;username,text;mobile,text;create_time,text;ip,text;seo_engine,text' +
            '&dede_fieldshash=2057ab00d5c69788a4782d60407bc7b5';

        $.ajax({
            type: "POST",
            url: "/plus/diy.php",
            data: dataString,
            success: function(data) {
                formWrap[0].reset();
                layer.msg('提交成功');
            }
        });
        return false;
        
    }


    function submitPopupInfo() {
        var formWrap = $('.popup-form');

        var _shop_name = $('#popup-shop_name'),
            _shop_nameVal = _shop_name.val();

        var _username = $('#popup-username'),
            _usernameVal = _username.val();

        var _mobile = $('#popup-mobile'),
            _mobileVal = _mobile.val();

        var _dateStr = new Date(),
            _currentDate = _dateStr.Format("yyyy-MM-dd hh:mm:ss");


        if (_usernameVal == '') {
            layer.msg('请输入您的姓名');
            _username.focus();
            return false;
        }

        if (_mobileVal == '') {
            layer.msg('请输入您的手机号');
            _mobile.focus();
            return false;
        } else if (!/^1[0-9]{10}/.test(_mobileVal)) {
            layer.msg('手机号格式不正确');
            _mobile.focus();
            return false;
        }


        var dataString =
            '&shop_name=' + _shop_nameVal + '（共享系统）' +
            '&username=' + _usernameVal +
            '&mobile=' + _mobileVal +
            '&create_time=' + _currentDate +
            '&ip=' + returnCitySN["cip"] +
            '&seo_engine=' + _seo_engine +
            '&action=post' +
            '&diyid=1&do=2' +
            '&dede_fields=shop_name,text;username,text;mobile,text;create_time,text;ip,text;seo_engine,text' +
            '&dede_fieldshash=2057ab00d5c69788a4782d60407bc7b5';

        $.ajax({
            type: "POST",
            url: "/plus/diy.php",
            data: dataString,
            success: function(data) {
                formWrap[0].reset();
                layer.msg('提交成功');
            }
        });
        return false;
        
    }
</script>